All Questions
Tagged with programming-challengeswift
45 questions
5votes
2answers
596views
Leet Code 139 (Word Break) using a trie with recursion
I was attempting to solve LeetCode 139 - Word Break Given a string s and a dictionary of strings wordDict, return ...
1vote
1answer
314views
Finding the winner of a tic-tac-toe game in Swift
Working on the problem Find Winner on a Tic Tac Toe Game, I took several hours longer than an artificial time constraint the site had for mock interview purposes. This leads me to wonder if my ...
1vote
1answer
216views
Minimum Window Substring in Swift exceeds LeetCode runtime check
This is a popular question on LeetCode: 76. Minimum Window Substring Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in ...
2votes
1answer
3kviews
Dynamic Array Problem (Hacker rank)
I am trying to solve the Dynamic Array problem on HackerRank: Create a list, seqList, of N empty sequences, where each sequence is indexed from 0 to N-1. The elements within each of the N ...
3votes
1answer
528views
Minimum window substring - LeetCode challenge
Below is my code for the “Minimum Window Substring” LeetCode problem in Swift: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(...
4votes
1answer
1kviews
Jumping on the clouds
I have started the Hackerrank interview preparation kit. The first problem I have solved with Swift is as follows: Emma is playing a new mobile game that starts with consecutively numbered clouds. ...
8votes
3answers
1kviews
Leetcode 38: The “count-and-say” sequence
38. Count and Say The count-and-say sequence is the sequence of integers with the first five terms as following: ...
5votes
1answer
573views
Leetcode 102: Binary tree level-order traversal in Swift
102. Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary ...
1vote
2answers
665views
Minimum Area Rectangle in Swift
This is my solution to LeetCode – Minimum Area Rectangle in Swift 939. Minimum Area Rectangle Given a set of points in the xy-plane, determine the minimum area of a rectangle formed from these points,...
2votes
2answers
1kviews
Valid Sudoku in Swift
This is my solution to LeetCode – Valid Sudoku in Swift. ...
7votes
1answer
627views
Swiftly counting rooms in a floor plan
Inspired by recent questions about counting the rooms in a floor plan (1, 2, 3), here is my attempt to solve the problem with a Swift program. The problem (from “Counting Rooms” on CSES) is: You ...
1vote
1answer
2kviews
Numbers as Strings Multiplication Function in Swift
I was solving a problem 20, Factorial Digit Sum, on Project Euler. Factorial Digits Sum \$n!\$ means \$n \cdot (n − 1) \cdot \ldots \cdot 3 \cdot 2 \cdot 1\$ For example, \$10! = 10 \cdot ...
2votes
1answer
477views
HackerRank Caesar Cipher, not using map, filter, reduce, regex
Julius Caesar protected his confidential information by encrypting it in a cipher. Caesar's cipher rotated every letter in a string by a fixed number, K, making it ...
4votes
1answer
846views
Checking whether strings are permutations of each other in Swift
I'm solving this problem on Hacker Earth, just for practice. The exercise is to determine whether two given equal-length strings are permutations of each other. Except for this one test case, which ...
3votes
1answer
164views
Project Euler problem #14 (longest Collatz chain) in Swift
This is my Swift code for finding the starting number, under one million, which produces the longest collatz chain. ...